Ahmad-React-w3-Assignment#31
Open
AhmadSaadeddin1987 wants to merge 1 commit intoHackYourAssignment:mainfrom
Open
Ahmad-React-w3-Assignment#31AhmadSaadeddin1987 wants to merge 1 commit intoHackYourAssignment:mainfrom
AhmadSaadeddin1987 wants to merge 1 commit intoHackYourAssignment:mainfrom
Conversation
6886964 to
77bcd75
Compare
sycons
requested changes
Jan 18, 2026
sycons
left a comment
There was a problem hiding this comment.
Following were implemented:
- Copy over the assets folder to your ecommerce/src folder ✅
- A context that stores the id of all of the favourites of the user (not the whole object) ✅
- Heart clicked on product list page and product details page updates the favourites array in the context ✅
- Create a
useFetchcustom hook to reuse logis forloadinganderrorstates ✅ - Deploy app somewhere (like netlify) and add link to PR ✅
Requested improvements:
- Favourites page should list the products user has favourited
- Navigation bar at the top should handle routing between
/and/favourites - Fix linting error in FavouritesContext.jsx. I've added comment on the file. You can also run
npm run lintto view the linting errors.
| return ( | ||
| <nav className="navbar"> | ||
| <h1>Ecommerce</h1> | ||
| </nav> |
There was a problem hiding this comment.
There are no links here for the home and favourites pages here. The user needs a way to navigate to these pages.
Please have a look at how it works in the live version:
https://hyf-react-w3-example.netlify.app/
|
|
||
| <Routes> | ||
| <Route path="/" element={<Products />} /> | ||
| <Route path="/product/:id" element={<ProductDetail />} /> |
| import { FavouritesContext } from "../context/FavouritesContext"; | ||
| import heartSolid from "../assets/heart-solid.svg"; | ||
|
|
||
| function Favourites() { |
There was a problem hiding this comment.
This component does not get rendered in the app at all.
| @@ -0,0 +1,21 @@ | |||
| import { createContext, useState } from "react"; | |||
|
|
|||
| export const FavouritesContext = createContext(); | |||
There was a problem hiding this comment.
Please fix this linting error "Fast refresh only works when a file only exports components. Move your React context(s) to a separate file."
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://ecommerece-33.netlify.app/